package com.example.content.repository.oprators

import com.example.content.ACCESS_TOKEN
import com.example.content.AUTHORIZATION
import com.example.content.viewmodule.login.TokenStore
import okhttp3.Interceptor
import okhttp3.Response

/**
 * Created by zhudongao
 * Desc
 * Date 2020/11/11
 */
class HeaderInterceptor : Interceptor {

    override fun intercept(chain: Interceptor.Chain): Response {
        val request = chain.request()
            .newBuilder()
            .addHeader(AUTHORIZATION, "Bearer ${TokenStore.token.trim()}")
            .build()
        return chain.proceed(request)
    }
}